import { Directionality, Direction } from '@angular/cdk/bidi'
import { EventEmitter, Injectable, OnDestroy } from '@angular/core'

@Injectable({
  providedIn: 'root'
})
export class AppDirectionality implements Directionality, OnDestroy{
  readonly change = new EventEmitter<Direction>()

  private val: Direction = 'ltr'

  get value(): Direction {
    return this.val
  }

  set value(value: Direction) {
    this.val = value
    this.change.next(value)
  }

  ngOnDestroy(): void {
    this.change.complete()
  }
}
